]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Listen to IbusPanelService::focus-in/out to track focus changes
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 18 Sep 2018 10:54:29 +0000 (12:54 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Tue, 25 Sep 2018 23:49:42 +0000 (23:49 +0000)
In X11 there's no input panel state requests, so restore the previous behavior
that focused entries would always toggle the OSK on there.

js/misc/ibusManager.js
js/ui/keyboard.js

index 6452e492ffe46037500ed9a7c7da7cc2566aa230..34f198c35eed3144c018f1b0025e1fc73ceb0ba4 100644 (file)
@@ -119,6 +119,11 @@ var IBusManager = new Lang.Class({
                 let cursorLocation = { x, y, width: w, height: h };
                 this.emit('set-cursor-location', cursorLocation);
             });
+            this._panelService.connect('focus-in', (panel, path) => {
+                if (!GLib.str_has_suffix(path, '/InputContext_1'))
+                    this.emit ('focus-in');
+            });
+            this._panelService.connect('focus-out', () => { this.emit('focus-out'); });
 
             try {
                 // IBus versions older than 1.5.10 have a bug which
index be0146344eb6eb33a53a550cfd76b68df3417526..491495c57dff6d6975ee95dbed4d15044b7709a7 100644 (file)
@@ -519,6 +519,12 @@ var FocusTracker = new Lang.Class({
 
             this._setCurrentRect(rect);
         });
+        this._ibusManager.connect('focus-in', () => {
+            this.emit('focus-changed', true);
+        });
+        this._ibusManager.connect('focus-out', () => {
+            this.emit('focus-changed', false);
+        });
     },
 
     get currentWindow() {
@@ -590,6 +596,16 @@ var Keyboard = new Lang.Class({
             this._animFocusedWindow = null;
             this._oskFocusWindow = null;
         });
+        this._focusTracker.connect('focus-changed', (tracker, focused) => {
+            // Valid only for X11
+            if (Meta.is_wayland_compositor())
+                return;
+
+            if (focused)
+                this.show(Main.layoutManager.focusIndex);
+            else
+                this.hide();
+        });
 
         Meta.get_backend().connect('last-device-changed', 
             (backend, deviceId) => {